{% extends "admin/base.html" %}

{% block title %}{{ '編輯案例' if case else '添加案例' }} - 管理後台{% endblock %}

{% block page_title %}{{ '編輯案例' if case else '添加案例' }}{% endblock %}

{% block content %}
<div class="card">
    <div class="card-body">
        <form method="POST">
            <div class="mb-3">
                <label class="form-label">中文標題</label>
                <input type="text" class="form-control" name="zh_title" 
                       value="{{ case.zh_title if case else '' }}" required>
            </div>
            <div class="mb-3">
                <label class="form-label">英文標題</label>
                <input type="text" class="form-control" name="en_title" 
                       value="{{ case.en_title if case else '' }}" required>
            </div>
            <div class="mb-3">
                <label class="form-label">圖片URL</label>
                <input type="text" class="form-control" name="images" 
                       value="{{ case.images if case else '' }}" 
                       placeholder="多個圖片URL請用逗號分隔">
            </div>
            <div class="mb-3">
                <label class="form-label">中文內容</label>
                <textarea class="form-control" name="zh_content" rows="10" required>{{ case.zh_content if case else '' }}</textarea>
            </div>
            <div class="mb-3">
                <label class="form-label">英文內容</label>
                <textarea class="form-control" name="en_content" rows="10" required>{{ case.en_content if case else '' }}</textarea>
            </div>
            <div class="text-end">
                <a href="{{ url_for('admin.cases') }}" class="btn btn-secondary">取消</a>
                <button type="submit" class="btn btn-primary">保存</button>
            </div>
        </form>
    </div>
</div>
{% endblock %} 